import httpRequest from "@/utils/request.js";

export function GetModuleList(params) {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "GET",
			url: "/module/list",
			params
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}

export function GetModuleCategory() {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "GET",
			url: "/module/category"
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}

export function GetStarModule() {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "GET",
			url: "/module/star"
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}

export function AddStarModule(data) {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "POST",
			url: "/module/star",
			data
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}

export function RemoveStarModule(params) {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "DELETE",
			url: "/module/star",
			params
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}

export function SearchModule(params) {
	return new Promise((resolve, reject) => {
		httpRequest({
			method: "GET",
			url: "/module/search",
			params
		}).then(res => {
			resolve(res.data);
		}).catch(err => {
			reject(err);
		})
	})
}
